      
<template>
	<view class="content">
		<u-navbar bgColor="#fff" :placeholder="true" :fixed="true" @leftClick="$back" title="dream约文" titleStyle="{'color': '#000'}">
			
		</u-navbar>
		<view class="winbox">
			<view class="empytView" v-if="!list.total">
				<image :src="'/images/kong.png' | formatImgUrl" mode="widthFix" />
				<!-- <view>- 暂无列表 -</view> -->
			</view>
			<view class="winli" v-for="(item , index) in commentList" :key="index">
				<image :src="item.user.pic | formatImgUrl" class="headpic" mode="" @click="$go('/pages/my/my?id='+item.user.membe_id)"></image>
				<view class="jubox" style="padding: 10rpx;top: 0;"  @click="type=2,aid=item.id,show = true">
					<image :src="'/images/bao.png' | formatImgUrl" class="jubox" mode=""></image>
				</view>
				
				<view class="winyou">
					<view class="wintop" @click="$go('/pages/my/my?id='+item.user.membe_id)">
						<view class="nametxt">
							{{item.user.username}}
						</view>
					
					
					
						<image
							:src="$options.filters.formatImgUrl(item.user.writer_level.is_active?item.user.writer_level.level.image:item.user.writer_level.level.hide_img)"
							@click="$go('/pages/user/grade?uid='+info.user.membe_id)" class="jipic" mode=""
							v-if="item.user&&item.user.is_writer">
						</image>	
						
					<image v-if="item.user&&item.user.user_level.is_active"
							:src="$options.filters.formatImgUrl(item.user.user_level.active_day>0?item.user.user_level.level.image:item.user.user_level.level.hide_img)"
							class="biepic" mode="" >
						</image>
					
				
					
					
					
					</view>
					<view class="fuben">
						<rich-text :nodes="item.row"></rich-text>
					</view>
					<view class="windi">
						<view class="wintime">
							{{$options.filters.parseTime(item.create_time,'{y} - {m} - {d} {h}:{i}')}}  <text class="ip">{{item.ip_address || ''}}</text>
						</view>
						<view class="zabox" @click="userLike(2,item.id,3)">
							<image :src="(item.is_like ? '/images/zz1.png' : '/images/zz.png') | formatImgUrl"
								class="zapic" style="width: 36rpx;height: 36rpx;"></image>
							<view class="zatxt" :class="{zaactive:item.istrue}">
								{{item.like_num}}
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 举报弹框 -->
		<u-popup :show="show" @close="close">
			<view class="mask">
				<view class="matop" @click="goToreport">
					<image :src="'/images/jing.png'  | formatImgUrl" class="mapic" mode=""></image>
					<view class="matxt">
						举报
					</view>
					<image :src="'/images/rarr.png'  | formatImgUrl" class="mapic" mode=""></image>
				</view>
				<view class="qubox" @click="show = false">
					取消
				</view>
			</view>
		</u-popup>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				aid:'',
				type:2,
				id:'',
				page: 1,
				list: {},
				commentList: [],
				show:false,
			}
		},
		onLoad(e) {
			if(e.id && e.pid){
				this.id = e.id
				this.pid = e.pid
				this.getComment()
			}else{
				this.$common.errorToShow('参数异常')
			}
		},
		// 上拉加载
		onReachBottom() {
			if (this.list.current_page < this.list.last_page) {
				this.page++; // 页数加一，加载下一页数据
				this.getComment();
			}
		},
		methods: {
			getComment() {
				this.$api.default.request('Discover/getComment', {
					id:this.id,
					pid: this.pid,
					page: this.page
				}, 'POST', false).then((res) => {
					if (res.code) {
						this.list = res.data
						if (res.data.current_page > 1) {
							res.data.data.forEach((item) => {
								this.commentList.push(item)
							})
						} else {
							this.commentList = res.data.data
						}
					}
				})
			},
			close() {
				this.show = false
			},
			userLike(type = 2, id, is_msg) {
				this.$api.default.request('user/likeArticle', {
					id: id,
					type: type,
					is_msg: is_msg //0回复发布的内容 1回复评价 2内容点赞 3评价的点赞
				}, 'POST', false).then((res) => {
					if (res.code) {
						this.page = 1
						this.getComment()
					}
				})
			},
			goToreport(){
				this.show = false
				uni.navigateTo({
					url: '/pages/find/report?id=' + this.aid + '&type='+this.type + '&newtype=5'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: rgba(242, 245, 242, 1);
	}

	.content {
		

		.winbox {
			padding: 0 30rpx;
			margin-bottom: 20rpx;
			background-color: #ffffff;

			.winli {
				display: flex;
				align-items: flex-start;
				padding: 20rpx 0;
				border-bottom: 1px solid rgba(153, 153, 153, 0.1);
				position: relative;
				.jubox{
					position: absolute;
					top: 24rpx;
					right: 0rpx;
					width: 32rpx;
					height: 32rpx;
					// border: 1px dashed #eeeeee;
				}
				.headpic {
					width: 80rpx;
					height: 80rpx;
					flex-shrink: 0;
					border-radius: 20em;
				}

				.winyou {
					flex-grow: 1;
					padding-left: 12rpx;

					.wintop {
						display: flex;
						align-items: center;
						padding-bottom: 8rpx;

						.nametxt {
							font-size: 28rpx;
							color: #3D3D3D;
							padding-right: 8rpx;
							font-weight: bold;
						}

						.jipic {
							width: 41px;
							height:19px;
							margin-left: 4px;
						}

						.biepic {
							width: 41px;
							height:19px;
							margin-left: 4px;
						}
					}

					.fuben {
						font-size: 24rpx;
						font-weight: normal;
						letter-spacing: 0em;
						color: #3D3D3D;
						line-height: 34rpx;
						padding-bottom: 15rpx;
					}

					.huifu {
						height: 52rpx;
						border-radius: 4px;
						margin: 15rpx 0;
						padding: 0 12rpx;
						line-height: 52rpx;
						background: #F8F8F8;
						font-size: 20rpx;
						color: #3D3D3D;
					}

					.windi {
						display: flex;
						align-items: center;
						justify-content: space-between;

						.wintime {
							font-size: 20rpx;
							font-weight: normal;
							letter-spacing: 0em;
							color: #999999;
						}

						.zabox {
							display: flex;
							align-items: center;
							justify-content: space-between;

							.zapic {
								width: 28rpx;
								height: 28rpx;
							}

							.zatxt {
								font-size: 20rpx;
								letter-spacing: 0.08em;
								color: #999999;
								padding-left: 8rpx;
							}
							.zaactive{
								color: #45C4B0;
							}
						}
					}
				}
			}
		}
		.mask{
			background: #F2F5F2;
			border-top-left-radius: 8px;
			border-top-right-radius: 8px;
			overflow: hidden;
			.matop{
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding: 40rpx 68rpx ;
				margin-bottom: 20rpx;
				border-bottom: 1px solid rgba(153, 153, 153, 0.1);
				background-color: #ffffff;
				.mapic{
					width: 40rpx;
					height: 40rpx;
					flex-shrink: 0;
				}
				.matxt{
					flex-grow: 1;
					font-size: 28rpx;
					padding: 0 16rpx;
					font-weight: bold;
					letter-spacing: 0em;
					color: #3D3D3D;
				}
			}
			.qubox{
				line-height: 120rpx;
				text-align: center;
				font-size: 28rpx;
				font-weight: bold;
				letter-spacing: 0em;
				color: #3D3D3D;
				height: 120rpx;
				opacity: 1;
				background: #FFFFFF;
			}
		}
	}
</style>

    